import { post } from '@/utils/http'

// ========== 长租相关 API ========== //
// 计算租期
export const computeRentDayAPI = (data) => post({ url: '/V5/czsOrderInfo/getMonthDiff', data })
// 上传合同
export const uploadContractAPI = (data: any) => post({ url: '/V5/czsOrderInfo/uploadContract', data })
// 作废订单
export const invalidOrderAPI = (data) => post({ url: '/V5/czsOrderInfo/invalidOrder', data })
// 订单-列表
export const getListAPI = (data) => post({ url: '/V5/czsOrderInfo/pageList', data })
// 交/还车人维护
export const editGiveReturnStaffAPI = (data) => post({ url: '/V5/czsOrderInfo/editGiveReturnStaff', data })
// 取消订单
export const cancelOrderAPI = (data) => post({ url: '/V5/czsOrderInfo/cancel', data })
// 完成订单
export const finishAPI = (data) => post({ url: '/V5/czsOrderInfo/finish', data })
// 排车、改排
export const platoonCarAPI = (data) => post({ url: '/V5/czsOrderInfo/platoonCar', data })
// 查看合同
export const contractListAPI = (data) => post({ url: '/V5/czsOrderInfo/contractList', data })
// 添加费用
export const addOrderCostAPI = (data) => post({ url: '/V5/czsOrderInfo/addOrderCost', data })
// 短租订单-单量统计
export const findStatisticsAPI = (data) => post({ url: '/V5/czsOrderInfo/findStatistics', data })
// 修改订单
export const modifyOrderAPI = (data) => post({ url: '/V5/czsOrderInfo/modifyOrder', data })
// 获取合同编号
export const getContractNoAPI = (data) => post({ url: '/V5/czsOrderInfo/getContractNo', data })
// 创建订单
export const createOrderAPI = (data) => post({ url: '/V5/czsOrderInfo/createOrder', data })
// 短租订单-计算订单相关的金额
export const calcPriceAPI = (data) => post({ url: '/V5/czsOrderInfo/calcPrice', data })
// 订单交车
export const giveCarAPI = (data) => post({ url: '/V5/czsOrderInfo/giveCar', data })
// 订单完成前校验
export const finishCheckAPI = (data) => post({ url: '/V5/czsOrderInfo/finishCheck', data })
// 订单换车
export const replaceCarAPI = (data) => post({ url: '/V5/czsOrderInfo/replaceCar', data })
// 订单续租
export const reletOrderAPI = (data) => post({ url: '/V5/czsOrderInfo/reletOrder', data })
// 订单续租记录
export const getOrdrReletListAPI = (data) => post({ url: '/V5/czsOrderInfo/reletList', data })
// 订单还车
export const returnCarAPI = (data) => post({ url: '/V5/czsOrderInfo/returnCar', data })
// 订单-详情
export const getOrdrDetailsAPI = (data) => post({ url: '/V5/czsOrderInfo/detail', data })
// 订单-换车记录
export const carReplaceListAPI = (data) => post({ url: '/V5/czsOrderInfo/replaceList', data })
// 订单-账单计划-列表
export const billPlanListAPI = (data) => post({ url: '/V5/czsOrderInfo/billPlanList', data })
// 订单-账单计划-预览
export const billPlanListPreviewAPI = (data) => post({ url: '/V5/czsOrderInfo/payablePreview', data })
// 订单-分期账单计划-查看
export const payablePreviewAPI = (data) => post({ url: '/V5/czsOrderInfo/payablePreview', data })
// ========== 长租相关 API ========== //

// ========== 长租费用相关 API ========== //
// 订单费用信息
export const getOrdrFeeDetailAPI = (data) => post({ url: '/V5/czsOrderInfo/orderFeeList', data })
// 长租订单-费用信息 - 去确认
export const feetoConfirmAPI = (data) => post({ url: '/V5/czsOrderFee/toConfirm', data })
// 短租订单-费用信息 - 确认
export const feeSubmitAPI = (data) => post({ url: '/V5/czsOrderFee/confirm', data })
// 费用详情-编辑前
export const czsOrderFeeDetailAPI = (data: any) => post({ url: '/V5/czsOrderFee/selectById', data })
// 费用详情
export const orderFeeDetailAPI = (data) => post({ url: '/V5/orderFee/detail', data })
// 修改费用
export const modifyOrderFeeAPI = (data) => post({ url: '/V5/czsOrderFee/modify', data })
// 获取费用rate
export const calcRateAPI = (data: any) => post({ url: '/V5/czsOrderInfo/calcRate', data })
/** 修改续租 */
export const modifyReletAPI = (data: any) => post({ url: '/V5/czsOrderInfo/modifyRerent', data })
/** 删除续租 */
export const deleteReletAPI = (data: any) => post({ url: '/V5/czsOrderInfo/deleteRelet', data })
/** 续租校验 */
export const reletCheckAPI = (data: any) => post({ url: '/V5/czsOrderInfo/modifyRerentCheck', data })
// ========== 长租费用相关 API ========== //

// ========== 通用 API ========== //
// 更新会员驾驶证附件
export const uploadDriverFileAPI = (data) => post({ url: '/V5/czcCustMember/uploadDriverFile', data })
// 获取门店详情
export const getSiteLeaseDetailAPI = (data) => post({ url: '/V5/siteLease/siteDetail', data })
// 获取门店对应模板详情
export const getStoreTemplateAPI = (data) => post({ url: '/V5/tenantCostTemplate/selectBySiteId', data })
// 查看日历
export const getPriceCalendarAPI = (data) => post({ url: '/V5/tenantPriceTemplate/getCalendar', data })
// 获取还车门店列表
export const getSiteLeaseListAPI = (data) => post({ url: '/V5/siteLease/getSiteList', data })
// 根据手机号查询
export const findByPhoneAPI = (data) => post({ url: '/V5/czcCustMember/findByPhone', data })
// 短租订单-获取账号前置信息收付款方式
export const getAccountByPageDataAPI = (data) => {
  // 忽略退款抵扣违约金,需要显示 => 请加字段frontIsIgnore
  if ([undefined, null].includes(data.frontIsIgnore)) {
    data.ignoreWays = ['-2']
  }
  return post({ url: '/V5/inExpAccount/getWayByType', data })
}
// 短租订单-根据收付款方式和收付款类型查询账号信息
export const getAccountByWayAndTypeAPI = (data) => post({ url: '/V5/inExpAccount/getAccountByWayAndType', data })
// 获取押金的可用金额
export const queryActiveAmountAPI = (data) => post({ url: '/V5/sOrderDeposit/queryActiveAmount', data })
// 修改承租人
export const editMemberInfoAPI = (data) => post({ url: '/V5/czsOrderInfo/editMemberInfo', data })
// 排车校验
export const platoonCarCheckAPI = (data: any) => post({ url: '/V5/carStock/checkCarStock', data })
// 修改费用
export const czsOrderFeeModifyAPI = (data: any) => post({ url: '/czsOrderFee/modify', data })
// 根据开始日期计算结束日期
export const calcDateAPI = (data: any) => post({ url: '/tool/calcDate', data })

// 合同信息详情
export const getLongContractOrderDetail = (data) => post({ url: '/V5/czsOrderInfo/contractOrderDetail', data })

/** 修改车牌号长租换车记录· */
export const updateReplaceList = (data: any) => post({ url: '/V5/czsOrderInfo/getCzsOrderCarInfoList', data })

/** 修改车牌号 */
export const updateLongCarLicenseNo = (data: any) => post({ url: '/V5/czsOrderInfo/updateCarLicenseNo', data })
// ========== 通用 API ========== //

/** 订单好评 */
export const orderGoodEvaluate = (data) => post({ url: '/V5/czsOrderInfo/orderPositiveReviews', data })

/** 获取未好评订单 */
export const getNoEvaluateOrder = (data) => post({ url: '/V5/czsOrderInfo/getPositiveReviewsAllList', data })

/** 添加自定义标签 */
export const addCustomLabel = (data) => post({ url: '/V5/czsOrderInfo/addCustomLabel', data })
/** 备注操作记录 */
export const getRemarkLogApi = (data: any) => post({ url: '/V5/czsOrderInfo/operateRemarkLogList', data })

/** 修改换车备注 */
export const updateRemarkLogApi = (data: any) => post({ url: '/V5/czsOrderInfo/modifyReplaceCarRemark', data })

/** 添加订单备注 */
export const createRemarkApi = (data: any) => post({ url: '/V5/czsOrderInfo/createOrderRemark', data })

// 获取押金收取方式
export const getDepositWay = (data: any) => post({ url: '/V5/czsOrderInfo/getViolationDepositFee', data })

// 生成电子合同判断逻辑优化
export const checkContractData = (data: any) => post({ url: '/V5/svmsContract/checkContractData', data })

// 核实订单
export const verifyOrderApi = (data: any) => post({ url: '/V5/czsOrderInfo/orderAuditing', data })
